|
|
|
|
|
|
|
wsReadOnly.Close
wsReadWrite.Close
'
Set dbReadOnly = Nothing
Set dbReadWrite = Nothing
Set wsReadOnly = Nothing
Set wsReadWrite = Nothing
'
End Sub |
|
|
|
|
|
|
|
|
The code in Listing 9.9 declares and initializes several variables for the two Workspace and Database object pairs, along with some temp objects for the collection enumeration at the end of the routine. Then each workspace is created and appended to the collection, and the single database is opened once under each workspace session. Finally, all the workspaces and all their databases are listed on the screen. Note that you do not have to use different user names and passwords for the two Workspace objects. |
|
|
|
|
|
|
|
|
Save and run the project. When you click the OpenDB button, the program opens the database under two different workspaces and shows the results. Notice that the #Default Workspace# appears in the list. It always exists in the Workspaces collection. Check your screen against Figure 9.8. |
|
|
|
|
|
|
|
|
Figure 9.8.
The results of the OpenDatabase method in two workspaces. |
|
|
|
|
|
|
|
|
Creating and Opening Non-Microsoft Jet Databases |
|
|
|
|
|
|
|
|
You can only create Microsoft Jet-format databases using the CreateDatabase method. The other ISAM-type databases (dBASE, FoxPro, Paradox, and Btreive) all use a single directory or folder as the database object. To create non-Microsoft Jet databases, you have to create a new directory or folder on the disk drive. You can then use the OpenDatabase method to open the non-Microsoft Jet database. When it is opened, you can add tables and indexes using the existing Visual Basic data objects and methods. You'll learn about opening non-Microsoft Jet databases in the next section. |
|
|
|
|
|
|
|
|
The Database data object has 5 collections, 8 properties, and 16 methods. The Database object contains all the tables, queries, and relations defined for the database. It is also part of |
|
|
|
|
|